{include file="public/head" /}
{include file="public/js_ueditor" /}
<!--有理想的地方，地狱都是天堂-->
<!--Copyright @ df81.com 版权所有-->
<!--作者: 南国老符 邮箱：1062129401@qq.com-->
        <!-- 左侧菜单 开始 -->
        <div class="sidebar">
            <nav>
                <ul class="nav nav-pills nav-sidebar flex-column nav-flat nav-legacy d-block d-md-none" data-widget="treeview" role="menu" data-accordion="false">
                    {include file="public/left_content" /}
                </ul>
                <ul class="nav nav-pills nav-sidebar flex-column nav-flat nav-legacy d-block d-md-none" data-widget="treeview" role="menu" data-accordion="false">
                    {include file="public/left_data" /}
                </ul>
                <ul class="nav nav-pills nav-sidebar flex-column nav-flat nav-legacy" data-widget="treeview" role="menu" data-accordion="false">
                    {include file="public/left_global" /}
                </ul>
                <ul class="nav nav-pills nav-sidebar flex-column nav-flat nav-legacy d-block d-md-none" data-widget="treeview" role="menu" data-accordion="false">
                    {include file="public/left_system" /}
                </ul>
            </nav>
        </div>
        <!-- 左侧菜单 结束 -->
    </aside>
    <!-- 左侧 结束 -->
    <!-- 右侧 开始 -->
    <div class="content-wrapper">
        <!-- 内容导航 开始 -->
        <div class="content-header py-2 bg-white mb-3">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-sm-12">
                        <ol class="breadcrumb">
                            <li>{:lang('v_global')}<i class="fas fa-angle-right mx-2"></i></li>
                            <li>{:lang('v_global')}<i class="fas fa-angle-right mx-2"></i></li>
                            <li>{:lang('v_area')} {:lang('v_manage')}<i class="fas fa-angle-right mx-2"></i></li>
                            <li>{empty name="rs.id"}{:lang('v_add')}{else /}{:lang('v_edit')}{/empty} {:lang('v_area')}</li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>
        <!-- 内容导航 结束 -->
        <!-- 内容主体 开始 -->
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-md-12">
                        <div class="w-100 pt-3 pb-2 bg-white rounded mb-3">
                            <form name="form_keyword" action="{:url('/area/index',['lang'=>$lang])}" method="post" class="row">
                                <input type="hidden" name="lang" value="{$lang}">
                                <div class="col-md-8">
                                    <a class="btn btn-default mb-2 mr-2" href="{:url('/area/index',['lang'=>$lang])}"><i class="fas fa-map-marker-alt mr-1"></i>{:lang('v_area')} {:lang('v_manage')}</a>
                                    <a class="btn btn-success mb-2" href="{:url('/area/edit',['lang'=>$lang])}"><i class="fas fa-plus-circle mr-1"></i>{:lang('v_add')} {:lang('v_area')}</a>
                                </div>
                                <div class="col-md-4">
                                    <div class="input-group">
                                        <input name="keyword" placeholder="{:lang('v_quickfind')}" type="text" class="form-control">
                                        <span class="input-group-append">
                                            <button type="submit" class="btn btn-success"><i class="fa fa-search mr-1"></i>{:lang('v_search')}</button>
                                        </span>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="card card-outline card-success">
                            <div class="card-header"><i class="fas fa-edit mr-1"></i>{empty name="rs.id"}{:lang('v_add')}{else /}{:lang('v_edit')}{/empty} {:lang('v_area')}</div>
                            <div class="card-body">
                                <form name="form_edit" id="form_edit" method="post" action="{:url('/area/edit',['lang'=>$lang])}">
                                    <input type="hidden" name="id" value="{$rs.id}">
                                    <input type="hidden" name="level" value="0">
                                    <input type="hidden" name="lang" value="{$lang}">
                                    <div class="row form-group">
                                        <div class="col-md-3 col-form-label text-right text-danger">{:lang('v_areaname')} *</div>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control" name="title" value="{$rs.title}" placeholder="{:lang('v_areaname_tips')}" />
                                        </div>
                                    </div>
                                    <div class="row form-group">
                                        <div class="col-md-3 col-form-label text-right text-danger">{:lang('v_area')} {:lang('v_short')} *</div>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control" name="abbreviation" id="title" onblur="strtopy();" value="{$rs.abbreviation}" placeholder="" />
                                        </div>
                                    </div>
                                    <div class="row form-group">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_belong')} {:lang('v_area')}</div>
                                        <div class="col-md-4">
                                            <div class="input-group">
                                                <input name="tree_title" id="tree_title" type="text" class="form-control" value="{empty name="parent_title"}{:lang('v_top_sort')}{else /}{$parent_title}{/empty}">
                                                <a class="input-group-append" href="{:url('/area/index',['lang'=>$lang,'from'=>'viewlist','parentid'=>$rs['parentid'],'sortid'=>$rs['id']])}" data-target="#modal" data-toggle="modal">
                                                    <span class="btn btn-success">{:lang('v_select')} {:lang('v_belong')} {:lang('v_area')}</span>
                                                </a>
                                            </div>
                                            <input type="hidden" name="parentid" id="checkid" value="{empty name="rs.parentid"}0{else /}{$rs.parentid}{/empty}">
                                        </div>
                                    </div>
                                    <div class="row form-group">
                                        <div class="col-md-3 col-form-label text-right text-danger">{:lang('v_urlroute')} <span class="inline">*</span></div>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control pinyin urlroute" name="urlroute" placeholder="{:lang('v_urlroute_tips')}" value="{$rs.urlroute}" />
                                        </div>
                                    </div>
                                    <div class="row form-group">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_initial')}</div>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control sort_pinyin" name="initial" value="{$rs.initial}" placeholder="" />
                                        </div>
                                    </div>
                                    <div class="row form-group d-none">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_initial')}</div>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control sort_pinyin" name="initial" value="{$rs.initial}" />
                                        </div>
                                    </div>
                                    <div class="row form-group {if empty(config('global.url.city_site'))}d-none{/if}">
                                        <div class="col-md-3 text-right">{:lang('v_bind')} {:lang('v_domain')}</div>
                                        <div class="col-md-4">
                                            <label class="form-check form-check-inline">
                                                <input type="radio" name="is_domain" value="0" {empty name="rs.is_domain"}checked="checked" {/empty} class="form-check-input" />{:lang('v_disable')}
                                            </label>
                                            <label class="form-check form-check-inline">
                                                <input type="radio" name="is_domain" value="1" {eq name="rs.is_domain" value="1"}checked="checked" {/eq} class="form-check-input" />{:lang('v_enable')}
                                            </label>
                                            <input type="text" class="form-control bind_domain {if empty($rs.is_domain)}d-none{/if}" name="bind_domain" value="{$rs.bind_domain}" />
                                        </div>
                                    </div>
                                    <div class="row form-group bind_domain {if empty($rs.is_domain) or empty(config('global.url.city_site'))}d-none{/if}">
                                        <div class="col-md-3 text-right">{:lang('v_select')} {:lang('v_template')}</div>
                                        <div class="col-md-9">
                                            <?php $i = 0; ?>
                                            {volist name='list' id='mulu'}
                                                <?php $muluArr = explode('.',$mulu); ?>
                                                <label class="form-check form-check-inline">
                                                    <input type="radio" name="template" value="{$muluArr[0]}" {if $rs.template eq $muluArr[0] or (empty($rs.template) and $i eq 1)} checked="checked"{/if} class="form-check-input" />
                                                    {$muluArr[0]|msubstr=0,10}
                                                    <a class="ml-1" href="/api/common/view.html?lang={$lang}&thumb=/skin/index/{$mulu}" data-target="#modal" data-toggle="modal">
                                                        <img src="/skin/index/{$mulu}" width="30" height="20">
                                                    </a>
                                                </label>
                                                <?php $i ++; ?>
                                            {/volist}
                                        </div>
                                    </div>
                                    <div class="row form-group">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_seo')} {:lang('v_title')}</div>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control" name="seotitle" value="{$rs.seotitle}" placeholder="{:lang('v_seo_use_title')}" />
                                        </div>
                                    </div>
                                    <div class="row form-group">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_keyword')}</div>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control" name="keyword" value="{$rs.keyword}" />
                                        </div>
                                    </div>
                                    <div class="row form-group">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_description')}</div>
                                        <div class="col-md-4">
                                            <textarea name="description" rows="4" class="form-control">{$rs.description}</textarea>
                                        </div>
                                    </div>
                                    <div class="row form-group">
                                        <div class="col-md-3 text-right">{:lang('v_content_a')}</div>
                                        <div class="col-md-9">
                                            <textarea name="content1" id="content1a" style="width:100%; height:350px;">{$rs.content1}</textarea>
                                        </div>
                                    </div>
                                    <div class="row form-group">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_sequence')}</div>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control" name="sequence" value="{empty name="rs.sequence"}0{else /}{$rs.sequence}{/empty}" />
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="offset-md-3 col-md-9 mb-4">
                                            {if is_file(app()->getRootPath().'.env')}
                                                <button type="submit" class="do_ajax btn btn-success mr-4"><i class="fas fa-check-circle mr-2"></i>{:lang('v_save')}</button>
                                            {else /}
                                                <button type="button" class="do_ajax btn btn-success mr-4" onclick="javascript:do_ajax('#form_edit','.do_ajax','{:url('/area/edit',['lang'=>$lang])}','{:url('/area/index',['lang'=>$lang])}');"><i class="fas fa-check-circle mr-2"></i>{:lang('v_save')}</button>
                                            {/if}
                                            <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);"><i class="fa fa-angle-double-left mr-1"></i>{:lang('v_goback')}</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!-- 内容主体 结束 -->
    </div>
    <!-- 右侧 结束 -->
{include file="public/foot" /}
{include file="public/js_pinyin" /}
{include file="public/js_rich_text" /}
<script type="text/javascript">
// 禁用、启用绑定域名
$("input[name='is_domain']").click(function(){
    if($(this).val() == 1){
        $('.bind_domain').removeClass('d-none');
        var default_domain = $('.urlroute').val() + '.' + '{:request()->rootDomain()}';
        $('.bind_domain').val(default_domain);
    }else{
        $('.bind_domain').val('');
        $('.bind_domain').addClass('d-none');
    }
});
</script>
</body>
</html>